<template lang="html">
  <div class="el-form a">
    <el-form :model="pageData" :rules="rules" ref="ruleForm" label-width="160px" class="demo-ruleForm">
       <el-form-item label="Meta Keyword">
          <el-input v-model="pageData.metaKeyword" placeholder="请输入内容"></el-input>
       </el-form-item>
       <el-form-item label="Meta Description">
          <el-input v-model="pageData.metaDescription" placeholder="请输入内容"></el-input>
       </el-form-item>
       <el-form-item label="伪静态URL Code">
          <el-input v-model="pageData.staticUrlCode" placeholder="请输入内容"></el-input>
       </el-form-item>
       <el-form-item label="SEO标题">
          <el-input v-model="pageData.seoTitle" placeholder="请输入内容"></el-input>
       </el-form-item>
       <el-form-item class="confirm">
          <el-button type="primary" @click="submitForm('post')">提交</el-button>
       </el-form-item>
    </el-form>
  </div>
</template>

<script>
  import {
    allSeo,
    seodetails
  } from "@/api/shoppingCentre/shoppingCentre";
export default {
  data () {
    return {
      pageData : {
        metaKeyword : '',
        metaDescription :'',
        staticUrlCode :'',
        seoTitle : '',
        seoHideWords : '',
        goodsId : this.$store.state.category.goodsId
      },
      rules : {}
    }
  },
  mounted () {
    if (this.$store.state.category.goodsId) {
        this.getdetails(this.$store.state.category.goodsId)
    }
  },
  methods : {
    getdetails (goodsId) {
        seodetails(goodsId).then(res=>{
          console.log(res);
        })
    },
    submitForm () {
      allSeo(this.pageData).then(res=>{
         if (res.data.code == 'OK') {
           this.$message.success('添加成功')
         } else {
           this.$message.error(res.data.message)
         }
      })
    }
  }
}
</script>

<style scoped>
  .a  {
    width:400px;
  }
</style>
